<template>
  <div class="app-container">
    <el-table ref="tables" v-loading="loading" :data="list" v-if="!loading">
      <el-table-column label="湿度" align="center">
        <template slot-scope="{ row }">
          <div>{{ row.humidityValue }}{{ row.humidityUnit }}</div>
        </template>
      </el-table-column>
      <el-table-column label="烟雾" align="center">
        <template slot-scope="{ row }">
          <div>{{ row.smokeValue }}{{ row.smokeUnit }}</div>
        </template>
      </el-table-column>
      <el-table-column label="硫化氢" align="center">
        <template slot-scope="{ row }">
          <div>{{ row.sulfurHValue }}{{ row.sulfurHUnit }}</div>
        </template>
      </el-table-column>
      <el-table-column label="温度" align="center">
        <template slot-scope="{ row }">
          <div>{{ row.temperatureValue }}{{ row.temperatureUnit }}</div>
        </template>
      </el-table-column>
      <el-table-column label="记录时间" align="center" prop="createTime" width="200">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.createTime) }}</span>
        </template>
      </el-table-column>

    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
      @pagination="getList" />
  </div>
</template>

<script>
import { getGasList, } from "@/api/system/resource";

export default {
  name: "GasList",
  data() {
    return {
      title: '气体记录',
      editId: null,
      // 遮罩层
      loading: true,
      // 总条数
      total: 0,
      // 表格数据
      list: [],
      // 表单参数
      form: { bucketNumber: '', name: '', type: 2, areaLocation: {}, capacity: '', thresholdValue: "" },
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
    };
  },

  created() {
    this.getList();
  },
  methods: {
    /** 查询登录日志 */
    async getList() {
      this.loading = true;
      const res = await getGasList(this.queryParams);
      if (res.code === 200) {
        this.list = res.rows;
        this.total = res.total;
        this.loading = false;
        return;
      }
      this.$modal.msgSuccess(res.msg);
    },

    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
  },

};
</script>
<style lang="scss" scoped>
.manage-add-btn {
  float: right;
}

.dialog-footer {
  text-align: center;
}
</style>
